package com.sheepjin.design_pattern.行为型模式.观察者模式;

import com.sheepjin.design_pattern.行为型模式.观察者模式.entity.BinaryObserver;
import com.sheepjin.design_pattern.行为型模式.观察者模式.entity.HexaObserver;
import com.sheepjin.design_pattern.行为型模式.观察者模式.entity.OctalObserver;
import com.sheepjin.design_pattern.行为型模式.观察者模式.entity.Subject;

/**
 * 观察者模式测试demo
 *
 * @author yang
 */
public class ObserverPatternDemoTest {
    public static void main(String[] args) {
        Subject subject = new Subject();

        new HexaObserver(subject);
        new OctalObserver(subject);
        new BinaryObserver(subject);

        System.out.println("First state change: 15");
        subject.setState(15);
        System.out.println("---------------------------");
        System.out.println("Second state change: 10");
        subject.setState(10);
    }
}
